#include "stdafx.h"
#include "wf_layersfreezeall.h"

#include "pf_graphic.h"



WF_LayersFreezeAll::WF_LayersFreezeAll(bool freeze,
        PF_Container& container,
        PF_GraphicView& graphicView)
        :PF_ActionInterface("Freeze all Layers",
                    container, graphicView) {

    this->freeze = freeze;
}

QAction* WF_LayersFreezeAll::createGUIAction(LX_Define::ActionType type, QObject* /*parent*/) {
    QAction* action=NULL;
	
	if (type==LX_Define::ActionLayersFreezeAll) {
		// tr("Freeze all")
		action = new QAction(tr("&Freeze all"),  NULL);
    	//action->zetStatusTip(tr("Freeze all layers"));
		action->setIcon(QIcon(":/ui/hiddenblock.png"));
	}
	else if (type==LX_Define::ActionLayersDefreezeAll) {
		// tr("Defreeze all")
        action = new QAction(tr("&Defreeze all"),   NULL);
        //action->zetStatusTip(tr("Defreeze all layers"));
		action->setIcon(QIcon(":/ui/visibleblock.png"));
	}
    return action;
}


void WF_LayersFreezeAll::trigger() {
    PF_DEBUG->print("PF_ActionLayersFreezeAll::trigger");
    if (graphic!=NULL) {
        //PF_Layer* layer = graphic->getActiveLayer();
        graphic->freezeAllLayers(freeze);
    }
    finish();
}



void WF_LayersFreezeAll::init(int status) {
    PF_ActionInterface::init(status);
    trigger();
}

// EOF
